export default {
	state: {
		playing: false,
		playList: [],
		categoryId: 10000000,
		musicListId: 0,
		curIndex: 0,
		loginData: {
			name: '李晶晶',
			birth: '0828'
		}	
	},
	getters: {
		curSong: state => {
			return state.playList[state.curIndex] || {}
		},

		curListLen: state => {
			return state.playList.length;
		}
	},
	mutations: {
		play (state) {
      		state.playing = true
    	},
    	pause (state) {
      		state.playing = false
    	},
    	checkCategoryId(state, id) {
    		state.categoryId = id
    	},
    	checkMusic(state, obj) {
    		state.playList.unshift(obj);
    		state.curIndex = 0
    	},
    	changeIndex(state, index) {
    		state.curIndex = index;
    	},
    	playAllList(state, arr) {
    		state.playList = [...arr]
    	}

	}
}